import java.io.FileWriter;
import java.io.IOException;
import java.net.PortUnreachableException;

public class AADL {

    public AADL(){

    }

    public void genAADLFunc()
    {



    }
    public void genAADLEnd()
    {
        System.out.println("end basenode;");
    }

    public void genAADLName(String name)
    {
        System.out.println("process "+name+"\n" +
                "end "+name+";\n" +
                "\n" +
                "process implementation "+name+".base\n" +
                "\tsubcomponents\n" +
                "\t\tinitialize : thread initialize.impl;\n" +
                "\t\tinitialize_re : thread initialize_re.impl;\n" +
                "\t\tmakePlan : thread makePlan.impl;\n" +
                "\t\tclearRobotCell : thread clearRobotCell.impl;\n" +
                "\t\tpublishPlan : thread publishPlan.impl;\n" +
                "end "+name+".base;");
    }

    public void genAADLSys(int index,String name) throws IOException {

        System.out.println("system nd\n" +
                "\t\t\n" +
                "\tend nd;\n" +
                "\tsystem implementation nd.impl\n" +
                "\t\tsubcomponents\n" +
                "\t\t\t\n" +
                "\t\t\t"+name+":process global_planner.impl;\n" +

                "\t\tproperties\n" +

                "\t\t\tParam_Property::package_name=> \"planner\" applies to "+name+";\n" +
                "\t\t\tParam_Property::include_file=>  \""+name+"_include.h\" applies to "+name+";\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_initialize.cpp\" applies to "+name+".initialize;\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_initialize_re_"+index+".cpp\" applies to "+name+".initialize_re;\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_makePlan.cpp\" applies to "+name+".makePlan;\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_clearRobotCell.cpp\" applies to "+name+".clearRobotCell;\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_publishPlan.cpp\" applies to "+name+".publishPlan;\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_mapToWorld.cpp\" applies to "+name+".mapToWorld;\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_getPlan.cpp\" applies to "+name+".getPlan;\n" +
                "\t\t\tParam_Property::source_file=>  \""+name+"_SmoothPlan.cpp\" applies to "+name+".SmoothPlan;\n" +
                "\tend nd.impl;");
    }
}
